package csc.daonjpa.java.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "transaction")
public class Transaction implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name = "transactionid")
	private Long transactionId;
	
	@Column(name = "date")
	private String date;
	
	@Column(name = "description")
	private String description;
	
	@Column(name = "amount")
	private long amount;
	
	@ManyToOne
	@JoinColumn(name = "receive_customer")
	private Customer receivedCustomer;
	
	@ManyToOne
	@JoinColumn(name = "send_customer")
	private Customer sendCustomer;
	
	@Column(name = "reason")
	private String denyReason;
	
	@ManyToOne
	@JoinColumn(name = "stateid")
	private TransactionState transactionState;
	
	public Transaction(Long transactionId, String date, String description,
			long amount, Customer receivedcustomer, Customer sendcustomer,
			TransactionState transactionState) {
		super();
		this.transactionId = transactionId;
		this.date = date;
		this.description = description;
		this.amount = amount;
		this.receivedCustomer = receivedcustomer;
		this.sendCustomer = sendcustomer;
		this.transactionState = transactionState;
	}

	public Transaction() {
		super();
	}

	/**
	 * @return the transactionId
	 */
	public Long getTransactionId() {
		return transactionId;
	}

	/**
	 * @param transactionId the transactionId to set
	 */
	public void setTransactionId(Long transactionId) {
		this.transactionId = transactionId;
	}

	/**
	 * @return the date
	 */
	public String getDate() {
		return date;
	}

	/**
	 * @param date the date to set
	 */
	public void setDate(String date) {
		this.date = date;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	/**
	 * @return the amount
	 */
	public long getAmount() {
		return amount;
	}

	/**
	 * @param amount the amount to set
	 */
	public void setAmount(long amount) {
		this.amount = amount;
	}

	/**
	 * @return the receivedCustomer
	 */
	public Customer getReceivedCustomer() {
		return receivedCustomer;
	}

	/**
	 * @param receivedCustomer the receivedCustomer to set
	 */
	public void setReceivedCustomer(Customer receivedCustomer) {
		this.receivedCustomer = receivedCustomer;
	}

	/**
	 * @return the sendCustomer
	 */
	public Customer getSendCustomer() {
		return sendCustomer;
	}

	/**
	 * @param sendCustomer the sendCustomer to set
	 */
	public void setSendCustomer(Customer sendCustomer) {
		this.sendCustomer = sendCustomer;
	}

	/**
	 * @return the transactionState
	 */
	public TransactionState getTransactionState() {
		return transactionState;
	}

	/**
	 * @param transactionState the transactionState to set
	 */
	public void setTransactionState(TransactionState transactionState) {
		this.transactionState = transactionState;
	}

	/**
	 * @return the denyReason
	 */
	public String getDenyReason() {
		return denyReason;
	}

	/**
	 * @param denyReason the denyReason to set
	 */
	public void setDenyReason(String denyReason) {
		this.denyReason = denyReason;
	}
	
}